var endOpacity = 50;
var increaseOpacityBy = 5;
var timeout = 10;
var win;
var winbackground;
var wincontent;
var promptText;
var promptImg;
var promptButton;
var curOpacity = 0;
var timer = null;


function showPrompt(img, txt, btn) {
	win = document.getElementById('promptWindow');
	winbackground = document.getElementById('promptBackground');
	wincontent = document.getElementById('propmtContent');
	promptText = txt;
	promptImg = img;
	promptButton = btn;
	if(timeout > 0) {
		curOpacity = 0;
	
		winbackground.style.opacity = curOpacity / 100;
		winbackground.style.filter = 'alpha(opacity=' + curOpacity + ')';
		win.style.display = 'block';
		wincontent.style.display = 'none';
	
		timer = setTimeout('increaseOpacity()',timeout);
	}
	else {
		winbackground.style.opacity = endOpacity / 100;
		winbackground.style.filter = 'alpha(opacity=' + endOpacity + ')';
		win.style.display = 'block';
		wincontent.style.display = 'block';
	}
}

function increaseOpacity() {
	curOpacity += increaseOpacityBy;

	winbackground.style.opacity = curOpacity / 100;
	winbackground.style.filter = 'alpha(opacity=' + curOpacity + ')';
	
	if(curOpacity < endOpacity) {
		timer = setTimeout('increaseOpacity()',timeout);
	}
	else {
		wincontent.style.display = 'block';
		document.getElementById('prompt-img').innerHTML = '<img src="' + promptImg + '" />';
		document.getElementById('prompt-text').innerHTML = promptText;
		document.getElementById('prompt-close').innerHTML = '<input id="close-prompt" type="button" value="' + promptButton + '" onClick="hideWindow()">';
	}
}

function hideWindow() {
	win.style.display = 'none';
}